<include file="common:__head__" />
<div class="permissions-content">
    <div class="permissions-le">
        <span class="add-admin"><a href="javascript:history.go(-1)"></a>返回</span>
            <div class="ncap-order-details">
                <form action="" method="post" id="delivery_form">
                    <input type="hidden" name="m" value="Admin">
                    <input type="hidden" name="c" value="Order">
                    <input type="hidden" name="a" value="invoice">
                    <input type="hidden" value="{$order['id']}" name="order_id">
                    <input type="hidden" value="{$consignor['time']}" name="order_time">
                    <div class="tabs-panels">
                    <div class="misc-info">
                        <h3>基本信息</h3>
                        <dl>
                            <dt>订单 ID：</dt>
                            <dd>{$order['id']}</dd>
                            <dt>订单号：</dt>
                            <dd>{$order['order_id']}</dd>
                            <dt>下单人：</dt>
                            <dd><if condition="$buyer['is_agent'] eq 1">{$buyer['agent_name']} - 非代理<else/>{$buyer['agent_name']} - 代理</if></dd>
                        </dl>
                        <dl>
                            <dt>下单人手机：</dt>
                            <dd>{$order['user_phone']}</dd>
                            <dt>订单金额：</dt>
                            <dd><a class="amt">{$order['price']}</a>（含运费）</dd>
                            <dt>运费：</dt>
                            <dd><a class="amt">{$order['freight_price']}</a></dd>
                        </dl>
                        <dl>
                            <dt>订单状态：</dt>
                            <dd>
                                <if condition="$order['is_pay'] eq -1">未付款<else/><a class="ft-success">已付款</a></if>
                                <switch name="order['status']">
                                    <case value="-1"><a class="amt">已取消</a></case>
                                    <case value="1">待确认</case>
                                    <case value="2"><a class="ft-success">已确认</a></case>
                                    <case value="3"><a class="ft-success">交易成功</a></case>
                                </switch>
                                <if condition="$order['is_deliver'] eq -1 AND $order['is_agree'] neq -1">
                                    未发货<elseif condition="$order['is_deliver'] eq -1 AND $order['is_agree'] eq -1"/>
                                    <a class="amt">董事审核不通过</a>
                                    <else /><a class="ft-success">已发货</a>
                                </if>
                            </dd>
                            <dt>下单时间：</dt>
                            <dd>{$order['time']|date="Y-m-d H:i:s",###}</dd>
                            <dt>支付方式：</dt>
                            <dd>{$p_name}</dd>
                        </dl>
                    </div>
                    <div class="addr-note">
                        <h4>收货信息</h4>
                        <dl>
                            <dt>收货人：</dt>
                            <dd>{$order['consignee']}</dd>
                            <dt>联系方式：</dt>
                            <dd>{$order['phone']}</dd>
                            <dt>收货地址：</dt>
                            <dd>{$order['detail_area']}</dd>
                        </dl>
                        <dl>
                            <dt>留言：</dt>
                            <dd>{$order['message']}</dd>
                        </dl>
                    </div>

                    <div class="addr-note">
                        <h4>发货信息</h4>
                        <dl>
                            <dt>发货人：</dt>
                            <dd>{$consignor['name']}</dd>
                            <if condition="$order['is_deliver'] eq 1">
                            <dt>发货时间：</dt>
                            <dd>{$consignor['time']}</dd>
                            </if>
                            <dt>发货物流：</dt>
                            <dd>{$logistics}</dd>
                        </dl>
                        <dl>
                            <dt>发货订单号：</dt>
                            <dd><input type="text" name="delivery_num" id="delivery_num" class="search-ipt w150" value="{$order['code_num']}"/></dd>
                            <dt>发货单备注：</dt>
                            <dd><textarea name="remark" placeholder="请输入操作备注" rows="3" class="form-control remark txt-area w300">{$order['update_order']}</textarea></dd>
                        </dl>
                    </div>

                    <div class="goods-info">
                        <h4>商品信息</h4>
                        <table>
                            <thead>
                            <tr>
                                <th>商品编号</th>
                                <th>商品图片</th>
                                <th>商品</th>
                                <th>该商品总价</th>
                                <th>数量</th>
                                <th>单位</th>
                                <th>发货数量</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="orderGoods" id="good">
                                <tr>
                                    <td>{$good['id']}</td>
                                    <input type="hidden" name="good_id[]" value="{$good['id']}">
                                    <td><a href="{$good['img']}" target="_blank"><img src="{$good['img']}" class="table-img"/></a></td>
                                    <td>{$good['g_name']|cut_str='15',###}</td>
                                    <td>{$good['goods_price']}</td>
                                    <td>{$good['num']}</td>
                                    <td><if condition="$good['good_type'] eq 2">箱<else/>件</if></td>
                                    <td><input type="text" name="deliveryed_num[]" value="{$good['reality_num']}" data-type="number" class="delivered_num table-input w50"/></td>
                                    <input type="hidden" name="good_type[]" value="{$good['good_type']}"/>
                                </tr>
                            </volist>
                        </table>
                    </div>
                    <p style="margin-top: 10px;">
                        <a class="btn btn-blue" id="submit" >保存</a>
                    </p>
                </div>
            </form>
        </div>
    </div>
    <div class="permissions-ri">
        <a href="" class="permissions-help">帮助和服务</a>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        $("#submit").click(function () {
            var delivery_num = $("#delivery_num").val();
            if(!delivery_num){
                layer.msg("请填写发货订单号",{time:750});return false;
            }
            $che_len = $(".delivered_num").length;
            for($i = 0;$i < $che_len;$i ++) {
                if (!$(".delivered_num").eq($i).val()) {
                    layer.msg("请填写此单发货数量", {time: 500});
                    return false;
                }
            }
            $("#delivery_form").submit();
        });
    });
</script>
</body>
</html>